/******************************************************************************
*
* MODULE:    TB_AluControl.v
* DEVICE:     Test Bench Alu 
* PROJECT:   Tarea 3 Diseño Electronico Digital
* AUTHOR:    Ricardo Dávila Castro   
* DATE:      2010 21:15:58
*
* ABSTRACT:  Testbench Alu Ejercicio 1
*            
******************************************************************************/

`timescale 1ns/100ps

`ifndef 	TB_ALUCONTROL
`define    TB_ALUCONTROL

module TB_AluControl;


reg [5:0] Opcode; 
reg [1:0] ALUOp;
reg [5:0] Funct; 
wire [4:0]wOp;

reg [31:0] DatoInA;
reg [31:0] DatoInB;

initial begin
 Opcode = 'h0;
 ALUOp = 'h 2;
 Funct = 'h 30;
 /* Aritmeticas*/ 
 #20 Funct = 'h 20;
 #20 Funct = 'h 29;
 #20 Funct = 'h 2B;
 #20 Funct = 'h 2F;
 #20 Funct = 'h 2C;
 #20 Funct = 'h 2D;
 /*Logicas*/
 #20 Funct = 'h 30;
 #20 Funct = 'h 24;
 #20 Funct = 'h 21;
 #20 Funct = 'h 25;
 #20 Funct = 'h 28;
 #20 Funct = 'h 26;
 #20 Funct = 'h 23;
 #20 Funct = 'h 2A; 
 /*Corrimiento*/
 #160 Funct = 'h 27;
 #160 Funct = 'h 2E;
 #160 Funct = 'h 31;
 #160 Funct = 'h 32;
 #160 Funct = 'h 33;
 #160 Funct = 'h 34;
 
end

initial begin
 DatoInA= 32'h 00_00_00_05;
 DatoInB= 32'h 00_00_00_03;
 forever wait (DatoInB == 32)
 DatoInB= 32'h 00_00_00_00;
end

initial begin
 wait (Funct == 'h 27)
  begin
 	DatoInB= 'h 00_00_00_00;
 	forever #5 DatoInB= DatoInB+1;
  end
end
 AluControl AluCtl_inst(.Opcode(Opcode),.ALUOp(ALUOp), .Funct(Funct), .Operacion(wOp));
 Alu Alu_inst(.DatoInA(DatoInA), .DatoInB(DatoInB),.Operacion(wOp));
  
endmodule
`endif